<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="Cache-Control" content="no-transform" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <!-- 第三方js和css -->
  <link rel="stylesheet" href="__ADMIN__/vendor/bootstrap-3.3.5/css/bootstrap.min.css" />
  <link rel="stylesheet" href="__ADMIN__/vendor/bootstrap-3.3.5/css/bootstrap-theme.min.css" />
  <link rel="stylesheet" href="__ADMIN__/vendor/font-awesome-4.4.0/css/font-awesome.min.css" />
  <link rel="stylesheet" href="__ADMIN__/css/base.css" />
  <!-- 第三方js和css -->

  <!-- jquery -->
  <script src="__ADMIN__/js/jquery-1.10.2.min.js"></script>
  <!-- jquery -->
  <title><{$title}></title>
</head>
<body>
<style type="text/css">
	.vcode{display:none;}
	.code{margin-left:280px;margin-top:-57px;width:150px;height:50px;}
</style>
<body>
<div class="container" style="margin-top:150px;">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
            <h4 class="modal-title center"><{$app_name}>后台登陆</h4>
          </div>
          <div class="modal-body">
              <div class="form-group">
                <label>用户名：</label>
                <input type="text" name="username" class="form-control" placeholder="请输入用户名" maxlength="20">
              </div>
              <div class="form-group">
                <label>密码：</label>
                <input type="password" name="password" class="form-control" placeholder="请输入密码" maxlength="20">    
              </div>
              <div class="form-group">
                <label>验证码：</label>
                <input type="text" name="code" class="form-control" placeholder="请输入验证码" style="width:200px;" maxlength="4">
                <img src="<{:captcha_src()}>" class="code" onClick="this.src=this.src+'?'+Math.random()" title="看不清？点击图片" />
              </div>
          </div>
          <div class="modal-footer">
          	<center>
            	<button type="submit"class="btn btn-info">确认登录</button>
            </center>
          </div>
          
        </div>
      </div>
    </div>
</body>
<script type="text/javascript">
$(function(){
    $('.btn-info').click(function(){
    	var username = $("input[name='username']").val();
      var password = $("input[name='password']").val();
    	var code = $("input[name='code']").val();

    	var allright = true;
		$('input[name]').each(function(k,v){
			if($.trim($(v).val())==''){
				alert($(v).attr('placeholder'));
				allright = false;
				return false;
			}
		})

		if(!allright) return false;

    	$.post('login',{'username':username,'password':password,'code':code},function(data){
            if(data.code){
            	alert('登录成功！');
            	location.href = data.url;
            }else{
            	alert(data.msg);
                // 刷新验证码
                $('.code').attr('src', $('.code').attr('src')+'?' + Math.random());
                $('input[name="code"]').val('');
            }
        },'json');
    })
})
</script>
</body>
  <script src="__ADMIN__/vendor/bootstrap-3.3.5/js/bootstrap.min.js"></script>
  <script src="__ADMIN__/js/base.js"></script>
</html>